home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr26
/
blrmu13.zip
/
GO.ASM
< prev
next >
Wrap
Assembly Source File
|
1993-06-01
|
4KB
|
154 lines
page ,132
title go ( chg to drv and dir ) as of 07/07/91 - 12:35 pm
;*-------------------------------------------------
;
; Go ( chg to drv or drv and dir )
;
; syntax :
; go x
; go x ddddddddd
;
; where x = new drv, and d = directory name
;
;*-------------------------------------------------
;
include iomac.lib
;
;*--------------------------------------
code segment para public 'code'
;*--------------------------------------
;
assume cs:code,ds:code,es:code
;
;*----------------
;* cmd line map
;*----------------
org 128
;*----------------
;
pl db 0 ; parm len ( includes space )
db 0 ; space
drv db 0 ; x
db 0 ; space
dir db 50 dup (0) ; directory name
;
;*------------------------------------
;* start of program memory location
;*------------------------------------
org 256
;*-------------------
;* pgm starts here
;*-------------------
;
go:
jmp pcl ; jump around data
;
;*-----------------------
;* data is stored here
;*-----------------------
;
cdem db 13,10,10
db ' * change directory error ! '
db 13,10,10
cdeml equ $-cdem
;
dpem db ' * drv / path = '
dpev db 53 dup (0)
dpeml equ $-dpem
;
cll db 13,10,10 ; cr, lf, lf
;
spl db 0 ; save parm len
;
dirpath label byte ; directory path
dpd db 0 ; dir path drv
db ':\'
dpn db 50 dup (0) ; dir path name
;
;*--------------------------
;* process command line
;*--------------------------
;
pcl:
cmp pl,0 ; parm len = 0 ?
je exit ; if so, exit
mov al,pl ; save
mov spl,al ; parm len
;
;*-----------------------
;* get drive letter
;*-----------------------
;
mov al,drv ; move drv ltr
mov dpd,al ; to dir path
call stnd ; set the new drv
;
;*---------------------------
;* get the name for ch dir
;*---------------------------
;
lea si,dir ; ptr to sors
lea di,dpn ; ptr to dest
mov cl,spl ; get len
sub ch,ch ; clear hi byte
cld ; set direction flag to forward
rep movsb ; move sors to dest
;
;*---------------------------------
;* get the name for err display
;*---------------------------------
;
lea si,dpd ; ptr to sors
lea di,dpev ; ptr to dest
mov cl,spl ; get len
sub ch,ch ; clear hi byte
cld ; set direction flag to forward
rep movsb ; move sors to dest
;
;*-------------------
;* do the ch dir
;*-------------------
;
ccd dirpath ; change directory
jnc exit ; if no err, exit
;
;*--------------------------
;* display error messages
;*--------------------------
;
waf 1,cdem,cdeml ; ch dir err msg
waf 1,dpem,dpeml ; drv / path err msg
waf 1,cll,3 ; cr, lf, lf
;
mov al,1 ; set ret code to 1
mov ah,76 ; term with ret code
int 33
;
exit:
;
waf 1,cll,3 ; cr, lf, lf
;
mov al,0 ; set ret code = 0
mov ah,76 ; term with ret code
int 33
;
;*--------------------------
;* set the new drv
;*--------------------------
;
stnd proc near
mov dl,al ; get drv ltr
sub dl,65 ; adjust it
cmp dl,4 ; hi limit ?
jbe doit ; if LT/EQ, ok, was upper case
sub dl,32 ; adjust it again, was lower case letter
doit:
mov ah,14 ; select
int 33 ; disk
ret ; return
stnd endp
;
code ends
;
end go